import requests
from bs4 import BeautifulSoup

def fetch_sina_news():
    # 请求新闻页面
    url = "http://news.sina.com.cn/"
    response = requests.get(url)
    response.encoding = 'utf-8'

    # 解析页面
    soup = BeautifulSoup(response.text, 'html.parser')
    news_list = soup.find_all('a', class_='news-item')

    # 提取新闻标题和链接
    result = []
    for news in news_list:
        title = news.text
        link = news.get('href')
        result.append({
            'title': title,
            'link': link
        })
    return result

if __name__ == "__main__":
    result = fetch_sina_news()
    for news in result:
        print(news)
